package com.yijianonghu.service.wxwebsite.search;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import org.springframework.stereotype.Service;

import com.yijianonghu.dal.model.SysBlog;
import com.yijianonghu.dal.model.SysBlogExample;
import com.yijianonghu.util.Constants;

import net.javahub.service.BaseService;

@Service
public class SearchService extends BaseService<SysBlog, Integer, SysBlogExample> {

	//搜索产品、服务
	public List<SysBlog> searchForProduct(String name, String orderBy, Integer offset, Integer limit) throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
		SysBlogExample example=new SysBlogExample();
		example.createCriteria()
			.andIncludeInWxIsNotNull()
			.andIncludeInWxEqualTo((byte) 1)
			.andTypeIsNotNull()
			.andTypeIn(Constants.WXConstants.WX_ALL_TYPES)
			.andRemoveflagIsNotNull()
			.andRemoveflagEqualTo((byte) 0)
			.andNameLike("%"+name+"%");
		example.setOrderByClause(orderBy);
		List<SysBlog> sysBlogList=selectListByExampleWithRowBounds(SysBlog.class, example, offset, limit);
		return sysBlogList;
	}
}
